using System;
using System.Text;
using System.Reflection;
using System.Collections.Generic;
using Microsoft.Practices.EnterpriseLibrary.PolicyInjection;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;


namespace EntLibContrib.PolicyInjection
{
    [ConfigurationElementType(typeof(NotMatchingRuleData))]
    class NotMatchingRule : IMatchingRule
    {
        IMatchingRule negated;

        public NotMatchingRule(IMatchingRule negated)
        {
            if (negated == null) throw new ArgumentNullException("negated");

            this.negated = negated;
        }

        #region IMatchingRule Members

        public bool Matches(MethodBase member)
        {
            return !negated.Matches(member);
        }

        #endregion
    }
}
